﻿Public Partial Class _Default2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.User.Identity.IsAuthenticated Then
            Dim manager As New BLL.AdvertiserManager
            Dim advertiser As Domain.dnc_Advertiser
            advertiser = manager.GetAdvertiser(BLL.UserManager.GetInstance().GetUsername())
            If advertiser Is Nothing Then
                CreateAccount()
            ElseIf advertiser.ID = 0 Then
                CreateAccount()
            End If
        Else
            ' Go to login
            Response.Redirect(Convert.ToString(My.Settings.LoginPage))
        End If
    End Sub

    Private Sub CreateAccount()

        Dim manager As New BLL.AdvertiserManager

        manager.AddAdvertiser(BLL.UserManager.GetInstance().GetUsername())

    End Sub
End Class